use tokio::sync::{mpsc::UnboundedSender, oneshot};

use crate::server::ServerCommand;

pub struct ServerHandle {
    cmd_tx: UnboundedSender<ServerCommand>,
}

impl ServerHandle {
    /// 创建 ServerHandle
    pub(crate) fn new(cmd_tx: UnboundedSender<ServerCommand>) -> Self {
        ServerHandle { cmd_tx }
    }

    /// 发送失败的消息
    pub(crate) fn worker_faulted(&self, idx: usize) {
        let _ = self.cmd_tx.send(ServerCommand::WorkerFaulted(idx));
    }
    
}
